#include "SpriteOilbarrel.h"

SpriteOilbarrel::SpriteOilbarrel(CL_GraphicContext gc)
{
	obcontext = gc;
	for(int h=0;h<FRAMES_OILBARREL;h++){
		obresources[h]=NULL;
	}
	obresources[0] = new CL_ResourceManager("Oilbarrel.xml");
	obresources[1] = new CL_ResourceManager("Fire.xml");
	for(int i=0;i<FRAMES_OILBARREL;i++){
		obsprites[i]=NULL;
	}
	obsprites[0] = new CL_Sprite(gc, "Oilbarrel", obresources[0]);
	obsprites[1] = new CL_Sprite(gc, "Fire", obresources[1]);
}


void SpriteOilbarrel::drawoilbarrel(CL_Vec2<int> position)
{
	obsprites[0]->draw(obcontext, 50, 590);
	obsprites[0]->update();
}

void SpriteOilbarrel::drawflame(CL_Vec2<int> position)
{
	obsprites[1]->draw(obcontext, position.x, position.y);
	obsprites[1]->update();
}

SpriteOilbarrel::~SpriteOilbarrel()
{
	for each(CL_Sprite* s in obsprites){
		if(s!=NULL){
			delete s;
			s=NULL;
		}
		
	}
	for each(CL_ResourceManager* rs in obresources){
		if(rs!=NULL){
			delete rs;
			rs=NULL;
		}
		
	}
}